<?php


namespace app\blog\controller\v1;


use app\blog\model\BloggerModel;
use app\BaseController;
use app\blog\model\BlogSettingModel;

class BlogSetting extends BaseController
{
    /**
     * 获取备案号
     * @return \think\response\Json
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\DbException
     * @throws \think\db\exception\ModelNotFoundException
     */
    public function getBlogSetting() {
        $arr = (new BlogSettingModel())->select()->toArray();
        return successJson($arr[0]);
    }

    /**
     * 获取博主信息
     * @return \think\response\Json
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\DbException
     * @throws \think\db\exception\ModelNotFoundException
     */
    public function getBloggerInfo() {
        $result = BloggerModel::find(1)
            ->visible(['blogger_content'])
            ->toArray();
        return successJson($result);
    }
}